<!-- <template>
    <input type="text" name="" id="" placeholder="账号" v-model="name">
    <input type="password" placeholder="旧密码" v-model="oldpwd">
    <input type="password" placeholder="新密码" v-model="newpwd">
    <button @click="change">修改密码</button>
</template>
<script setup>
import { ref, reactive } from 'vue';
import http from '@/http';
let name = ref()
let oldpwd = ref()
let newpwd = ref()
function change() {
    http({
        method: 'post',
        url: 'cpwd/',
        data: {
            uname: name.value,
            old_password: oldpwd.value,
            new_password: newpwd.value
        }
    }).then((resp) => {
        console.log(resp);
    }).catch((error
    ) => {
        console.log(error);

    })
}
</script>
<style scoped></style> -->



<template>
    <div class="change-password-page">
        <div class="change-password-container">
            <h1 class="page-title">修改密码</h1>
            <div class="form-group">
                <label for="username">账号</label>
                <input id="username" type="text" placeholder="请输入账号" v-model="name" autocomplete="username">
            </div>
            <div class="form-group">
                <label for="old-password">旧密码</label>
                <input id="old-password" type="password" placeholder="请输入旧密码" v-model="oldpwd"
                    autocomplete="current-password">
            </div>
            <div class="form-group">
                <label for="new-password">新密码</label>
                <input id="new-password" type="password" placeholder="请输入新密码" v-model="newpwd"
                    autocomplete="new-password">
            </div>
            <button @click="change" class="submit-button">确认修改</button>
            <div class="form-footer">
                <a href="#" class="forgot-password">忘记密码?</a>
            </div>
        </div>
    </div>
</template>

<script setup>
import { ref } from 'vue';
import http from '@/http';

const name = ref('');
const oldpwd = ref('');
const newpwd = ref('');

const change = () => {
    http({
        method: 'post',
        url: 'cpwd/',
        data: {
            uname: name.value,
            old_password: oldpwd.value,
            new_password: newpwd.value
        }
    }).then(resp => console.log(resp))
        .catch(error => console.log(error));
};
</script>

<style scoped>
.change-password-page {
    min-height: 100vh;
    background: url('https://ts1.tc.mm.bing.net/th/id/R-C.e3343aa8e6874c4b3703f98fcdbbe3e1?rik=%2bWpBT4qQo4iDSw&riu=http%3a%2f%2fimage.glwsq.cn%2f201910%E5%A3%81%E7%BA%B8_e4790325e7b13f3df8fc8967b1698cdc&ehk=qHUodgesM8g%2b%2fIG3qfehLkM7MQMswVIVZPIINXu3KBE%3d&risl=&pid=ImgRaw&r=0');
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.change-password-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    width: 380px;
    transition: transform 0.3s ease;
}

.change-password-container:hover {
    transform: translateY(-5px);
}

.page-title {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 24px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
}

input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    box-sizing: border-box;
}

input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

input[type="password"],
input[type="text"] {
    background: #f9f9f9;
}

.submit-button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.submit-button:hover {
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.form-footer {
    margin-top: 20px;
    text-align: center;
}

.forgot-password {
    color: #4CAF50;
    text-decoration: none;
    font-size: 14px;
}

.forgot-password:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .change-password-container {
        width: 90%;
        padding: 30px 20px;
    }
}
</style>